
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>

#if !defined _ur_enums_included
#include "ur_enums"
#endif

#define _ur_defs_included 1

#define PLUGIN "Ultra Rank MOD"
#define VERSION "1.0"
#define AUTHOR "Zabijaka"

#define MAX_PLAYERS 33
#define MAX_ID_LEN 33
#define BADGE_NONE -1
#define IS_PLAYER(%1) 0<%1<gMaxPlayers
#define OFFSET_LAST_HIT_GROUP      75
#define EXTRAOFFSET_PL_LINUX        5

new const MOTD1[]="%s<p><font color=blue size=5>%L: </font><font color=green size=4>%d XP</font></p>";
new const MOTD2[]="%s<p><font color=blue size=5>%L: </font><font color=green size=4>%d XP, %L</font></p>";
new const MOTD3[]="%s<tr><td>%s</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td></tr>";

//{ CVARS
new CVarActive;
new CVarSaveNick;
new CVarXpMinPlayers;
new CVarLastManWinMinOpponents;
new CVarBombDelXpOnlyLive;
new CVarMedals;
new CVarGuns;
new CVarVip;
new CVarDelXp;
//} CVARS

//{ ADDING XP
new CVarKillXp;
new CVarHeadXp;
new CVarBombAddXp;
new CVarHigherRankKillXp;
new CVarLastManWinXp;
new CVarRoundWinDeadXp;
new CVarRoundWinLiveXp;
new CVarVipKillXp;
new CVarMedalBronzeXp;
new CVarMedalSilverXp;
new CVarMedalGoldXp;
new CVarHostRescueXp;
//}

//{ REMOVING XP
new CvarDeathXp;
new CVarBombDelXp;
new CVarLowerRankKillXp;
new CVarRoundLooseXp;
new CVarSuacideXp;
new CVarHostKillXp;
//}

//{ PLAYER INFO
new gPlayerInfo[MAX_PLAYERS][CLIENT_INFO];
new gPlayerWaponLevelInfo[MAX_PLAYERS][WEAPONS][LEVELS];
new gPlayerWaponLevelReached[MAX_PLAYERS][WEAPONS][LEVELS];
//}

//{ GAME VARS
new gReqBadgeHud;
new gCenterHud;

new bombPlanter;
new lastManT;
new lastManCt;
new gMaxPlayers;

new gmsgShake;
//}


//{ WEAPONS DEF & GROUPS
new WEAPONS_PISTOLS[] = {
	WEAPONS_P228,
	WEAPONS_ELITE,
	WEAPONS_FIVESEVEN,
	WEAPONS_DEAGLE,
	WEAPONS_USP,
	WEAPONS_GLOCK18
	
};
new WEAPONS_SHOTGUNS[] = {
	WEAPONS_XM1014,
	WEAPONS_M3
}
new WEAPONS_SNIPERS[] = {
	WEAPONS_SCOUT,
	WEAPONS_AWP,
	WEAPONS_G3SG1,
	WEAPONS_SG550
}
new WEAPONS_SMG[] ={
	WEAPONS_MAC10,
	WEAPONS_UMP45,
	WEAPONS_MP5NAVY,
	WEAPONS_TMP,
	WEAPONS_P90
}
new WEAPONS_RIFELS[] = {
	WEAPONS_AUG,
	WEAPONS_GALIL,
	WEAPONS_FAMAS,
	WEAPONS_M4A1,
	WEAPONS_SG552,
	WEAPONS_AK47
}
new WEAPONS_OTHER[] ={
	WEAPONS_M249,
	WEAPONS_HEGRENADE,
	WEAPONS_KNIFE
}
new WeaponNamesShort[31][] = {
	"", //Blank
	"p228",
	"", //Nothing
	"scout",
	"he",
	"xm1014",
	"", //C4
	"mac10",
	"aug",
	"",
	"elite",
	"fiveseven",
	"ump45",
	"sg550",
	"galil",
	"famas",
	"usp",
	"glock18",
	"awp",
	"mp5navy",
	"m249",
	"m3",
	"m4a1",
	"tmp",
	"g3sg1",
	"",
	"deagle",
	"sg552",
	"ak47",
	"knife",
	"p90"
}

//}

//{ WEAPON BADGES REQUIREMENTS
new WEAPON_BADGE_LEVEL[WEAPONS][BADGES][LEVELS] = {
//					
/* SKIP BLANK		ROUND,	MAP, 	ALL	*/{ 
			{0, 0, 0, 0, 0,0}, 
			{0,0,0,0, 0,0},
			{0,0,0,0,0,0},
			{0,0, 0,0,0,0}, 
			{0,0,0, 0,0,0},
			{0,0,0,0,0,0},
			{0,0,0,0,0,0}},
/* WEAPONS_P228 */    {//K, H,	K, H,	K, H	
/* 	BEGINNER */	{2,0,	5, 0, 	30, 1},	
/* 	BASIC 	*/	{3, 1, 	10, 0, 	50, 0}, 
/* 	ADVANCED */	{0, 2, 	0, 0, 	70, 7},	
/* 	VETERAN */	{0, 0, 	0, 0, 	100,10},
/* 	EXPERT */	{4, 0,	15, 0, 	150, 0},
/* 	HITMAN */	{0, 2, 	0, 10, 	200,30},
/*	OWNER */	{4, 3, 	15, 10, 250, 50}},

/* SKIP NOTHING 	ROUND, 	MAP, 	ALL	*/ { 
			{0, 0, 0, 0, 0,0}, 
			{0,0,0,0, 0,0},
			{0,0,0,0,0,0},
			{0,0, 0,0,0,0},
			{0,0,0, 0,0,0},
			{0,0,0,0,0,0},
			{0,0,0,0,0,0}},

/* WEAPONS_SCOUT */   {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,  	5, 0,	30, 0},	
/* 	BASIC 	*/	{3, 0,	10, 0,	50, 0}, 
/* 	ADVANCED */	{3, 1,	0, 0,	80, 5},	
/* 	VETERAN */	{0, 0,	15, 0,	120, 10},
/* 	EXPERT */	{4, 0,	15, 0,	150, 0},
/* 	HITMAN */	{0, 2,	0, 5,	200, 20},
/*	OWNER */	{4, 2,	20, 8,	250, 30}},

/* WEAPONS_HEGRENADE */{//K, H,	K, H,	K, H
/* 	BEGINNER */	{0, 0,  	3, 0,	10, 0},
/* 	BASIC 	*/	{0, 0,	4, 0,	30, 0},
/* 	ADVANCED */	{0, 0,	5, 0,	50, 0},
/* 	VETERAN */	{0, 0,	5, 0,	80, 0},
/* 	EXPERT */	{0, 0,	6, 0,	100, 0},
/* 	HITMAN */	{0, 0,	7, 0,	120, 0},
/*	OWNER */	{0, 0,	8, 0,	150, 0}},
 
/* WEAPONS_XM1014 */  {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,	5, 0,	30, 1}, 	
/* 	BASIC 	*/	{2, 0,	10, 0,	50, 0},
/* 	ADVANCED */ 	{3, 1,	0, 0,	80, 5},
/* 	VETERAN */	{0, 0,	15, 0,	120, 10},
/* 	EXPERT */	{4, 0,	15, 0,	150, 0},
/* 	HITMAN */	{0, 2,	0, 5,	200, 20},
/*	OWNER */	{4, 2,	20, 8,	250, 30}},

/* SKIP C4		ROUND, 	MAP, 	ALL	*/ { 
			{0, 0, 0, 0, 0,0},
			{0,0,0,0, 0,0},
			{0,0,0,0,0,0},
			{0,0, 0,0,0,0},
			{0,0,0, 0,0,0},
			{0,0,0,0,0,0},
			{0,0,0,0,0,0}},

/* WEAPONS_MAC10 */   {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,	5, 0,	30, 1}, 
/* 	BASIC 	*/	{3, 0,	10, 0,	50, 0}, 
/* 	ADVANCED */ 	{3, 1,	10, 0,	80, 5},
/* 	VETERAN */	{0, 0,	15, 0,	120, 10},
/* 	EXPERT */	{4, 0,	15, 0,	150, 0},
/* 	HITMAN */	{0, 2,	0, 5,	200, 20},
/*	OWNER */	{4, 2,	20, 8,	250, 30}},

/* WEAPONS_AUG */     {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,	5, 0,	30, 1}, 
/* 	BASIC 	*/	{3, 1,	10, 0,	50, 0}, 
/* 	ADVANCED */ 	{0, 2,	0, 0,	80, 5},
/* 	VETERAN */	{0, 0,	15, 0,	120, 10}, 
/* 	EXPERT */	{4, 0,	15, 0,	150, 0},
/* 	HITMAN */	{0, 2,	0, 8,	200, 30},
/*	OWNER */	{4, 2,	20, 10,	250, 30}},

/* SKIP SMOKEGRENADE 	ROUND, 	MAP, 	ALL	*/ { 
			{0, 0, 0, 0, 0,0}, 
			{0,0,0,0, 0,0},
			{0,0,0,0,0,0},
			{0,0, 0,0,0,0},
			{0,0,0, 0,0,0},
			{0,0,0,0,0,0},
			{0,0,0,0,0,0}},
/* WEAPONS_ELITE */   {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,	5, 0,	30, 1}, 
/* 	BASIC 	*/	{3, 1,	10, 0,	50, 3}, 
/* 	ADVANCED */ 	{0, 2,	10, 0,	80, 5},
/* 	VETERAN */	{0, 0,	15, 0,	120, 10},
/* 	EXPERT */	{4, 0,	15, 0,	150, 15},
/* 	HITMAN */	{0, 2,	0, 8,	200, 20},
/*	OWNER */	{4, 2,	15, 8,	250, 30}},
	
/* WEAPONS_FIVESEVEN */{//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,	5, 0,	30, 1}, 
/* 	BASIC 	*/	{3, 1,	10, 0,	50, 3}, 
/* 	ADVANCED */	{0, 2,	10, 0,	80, 5},
/* 	VETERAN */	{0, 0,	15, 0,	120, 10},
/* 	EXPERT */	{4, 0,	15, 0,	150, 15},
/* 	HITMAN */	{0, 2,	0, 8,	200, 20},
/*	OWNER */	{4, 2,	15, 8,	250, 30}},
	
/* WEAPONS_UMP45 */   {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,	5, 0,   	30, 1}, 
/* 	BASIC 	*/	{3, 0,	10, 0,	50, 0}, 
/* 	ADVANCED */	{3, 1,	10, 0,	80, 5},
/* 	VETERAN */	{0, 0,	15, 0,	120, 10},
/* 	EXPERT */	{4, 0,	15, 0,	150, 20},
/* 	HITMAN */	{0, 2,	0, 5,	200, 30},
/*	OWNER */	{4, 2,	20, 8,	250, 30}},

/* WEAPONS_SG550 */   {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,	5, 0,	30, 1}, 
/* 	BASIC 	*/	{3, 1,	10, 0,	50, 0}, 	
/* 	ADVANCED */	{0, 2,	0, 0,	80, 5},
/* 	VETERAN */	{0, 0,	15, 0,	120, 10}, 
/* 	EXPERT */	{4, 0,	15, 0,	150, 20},
/* 	HITMAN */	{0, 2,	0, 8,	200, 30},
/*	OWNER */	{4, 2,	20, 10,	250, 30}},

/* WEAPONS_GALIL */   {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,	5, 0,	30, 1}, 
/* 	BASIC 	*/	{3, 1,	10, 0,	50, 0}, 
/* 	ADVANCED */	{0, 2,	10, 0,	80, 5},
/* 	VETERAN */	{0, 0,	15, 0,	120, 10},
/* 	EXPERT */	{4, 0,	15, 0,	150, 20},
/* 	HITMAN */	{0, 2,	0, 8,	200, 30},
/*	OWNER */	{4, 3,	20, 10,	250, 50}},

/* WEAPONS_FAMAS */   {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,	5, 0,	30, 1}, 
/* 	BASIC 	*/	{3, 1,	10, 0,	50, 0}, 
/* 	ADVANCED */	{0, 2,	10, 0,	80, 7},
/* 	VETERAN */	{0, 0,	15, 0,	120, 10},
/* 	EXPERT */	{4, 0,	15, 0,	170, 0},
/* 	HITMAN */	{0, 2,	0, 8,	200, 30},
/*	OWNER */	{4, 3,	20, 10,	250, 50}},
	
/* WEAPONS_USP */     {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,	5, 0,	30, 1},
/* 	BASIC 	*/	{3, 1,	10, 0,	50, 0},
/* 	ADVANCED */	{0, 2,	10, 0,	80, 5},
/* 	VETERAN */	{0, 0,	15, 0,	120, 10},
/* 	EXPERT */	{4, 0,	15, 0,	150, 0},
/* 	HITMAN */	{0, 2,	0, 8,	200, 20},
/*	OWNER */	{4, 2,	15, 8,	250, 30}},

//			ROUND, 	MAP, 	ALL
/* WEAPONS_GLOCK18 */ {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,	5, 0,	30, 1}, 
/* 	BASIC 	*/	{3, 1,	10, 0,	50, 0},
/* 	ADVANCED */	{0, 2,	10, 0,	80, 5},
/* 	VETERAN */	{0, 0,	15, 0,	120, 10},
/* 	EXPERT */	{4, 0,	15, 0,	150, 0},
/* 	HITMAN */	{0, 2,	0, 8,	200, 20},
/*	OWNER */	{4, 2,	15, 8,	250, 30}},
	
/* WEAPONS_AWP */      {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,	5, 0,	30, 0}, 
/* 	BASIC 	*/	{3, 0,	10, 0,	50, 0}, 
/* 	ADVANCED */	{3, 0,	0, 0,	80, 3},
/* 	VETERAN */	{0, 0,	10, 0,	120, 8},
/* 	EXPERT */	{4, 0,	15, 0,	150, 0},
/* 	HITMAN */	{4, 0,	0, 3,	200, 15},
/*	OWNER */	{4, 1,	20, 2,	250, 20}},
	
/* WEAPONS_MP5NAVY */ {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,	5, 0,	30, 1}, 
/* 	BASIC 	*/	{3, 1,	10, 0,	50, 0},
/* 	ADVANCED */	{0, 2,	10, 0,	80, 7},
/* 	VETERAN */	{0, 0,	15, 0,	120, 10},
/* 	EXPERT */	{4, 0,	15, 0,	170, 0},
/* 	HITMAN */	{0, 2,	0, 8,	200, 30},
/*	OWNER */	{4, 3,	20, 10,	250, 50}},
	
/* WEAPONS_M249 */     {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,  	5, 0,	30, 1}, 
/* 	BASIC 	*/	{3, 1,	10, 0,	50, 0}, 
/* 	ADVANCED */	{0, 2,	10, 0,	80, 7},
/* 	VETERAN */	{0, 0,	15, 0,	120, 10},
/* 	EXPERT */	{4, 0,	15, 0,	170, 0},
/* 	HITMAN */	{0, 2,	0, 8,	200, 30},
/*	OWNER */	{4, 3,	20, 10,	250, 50}},
	
/* WEAPONS_M3 */       {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,	5, 0,	30, 1}, 
/* 	BASIC 	*/	{2, 0,	10, 0,	50, 0}, 
/* 	ADVANCED */	{2, 1,	0, 0,	80, 5},
/* 	VETERAN */	{0, 0,	12, 0,	120, 10}, 
/* 	EXPERT */	{3, 0,	10, 2,	150, 0},
/* 	HITMAN */	{0, 1,	0, 5,	200, 20},
/*	OWNER */	{4, 1,	15, 3,	250, 20}},
	
/* WEAPONS_M4A1 */     {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,  	8, 0,	30, 1}, 
/* 	BASIC 	*/	{3, 1,	13, 0,	70, 0}, 
/* 	ADVANCED */	{3, 2,	15, 0,	80, 7},
/* 	VETERAN */	{3, 0,	15, 0,	150, 20},
/* 	EXPERT */	{4, 1,	15, 4,	200, 0},
/* 	HITMAN */	{0, 3,	0, 10,	250, 40},
/*	OWNER */	{4, 3,	20, 10,	500, 100}},
	
/* WEAPONS_TMP */      {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,	5, 0,	30, 1}, 
/* 	BASIC 	*/	{3, 1,	10, 0,	50, 0}, 
/* 	ADVANCED */	{0, 2,	10, 0,	80, 7},	
/* 	VETERAN */	{0, 0,	15, 0,	120, 10},
/* 	EXPERT */	{4, 0,	15, 0,	170, 0},
/* 	HITMAN */	{0, 2,	0, 8,	200, 30},
/*	OWNER */	{4, 3,	20, 10,	250, 50}},
	
/* WEAPONS_G3SG1 */   {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,  	5, 0,   	30, 1}, 
/* 	BASIC 	*/	{3, 0,	10, 0,	50, 0}, 
/* 	ADVANCED */	{3, 1,	10, 0,	80, 5},
/* 	VETERAN */	{0, 0,	12, 0,	120, 8},
/* 	EXPERT */	{4, 0,	15, 0,	150, 0},
/* 	HITMAN */	{0, 2,	0, 5,   	200, 20},
/*	OWNER */	{4, 2,	15, 3,	250, 30}},
	
/* SKIP FLASHBANG 	ROUND, 	MAP, 	ALL	*/ { 
			{0, 0, 0, 0, 0,0}, 
			{0,0,0,0, 0,0},
			{0,0,0,0,0,0},
			{0,0, 0,0,0,0}, 
			{0,0,0, 0,0,0},
			{0,0,0,0,0,0},
			{0,0,0,0,0,0}},

/* WEAPONS_DEAGLE */  {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,  	5, 0,   	30, 1}, 
/* 	BASIC 	*/	{3, 1,	12, 0,	50, 0}, 
/* 	ADVANCED */	{0, 2,	10, 3,	80, 5},
/* 	VETERAN */	{0, 0,	15, 0,	120, 10},
/* 	EXPERT */	{4, 0,	15, 0,	150, 0},
/* 	HITMAN */	{0, 2,	0, 8,	200, 20},
/*	OWNER */	{4, 2,	12, 5,	250, 30}},
	
/* WEAPONS_SG552 */   {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,  	5, 0,   	30, 1}, 
/* 	BASIC 	*/	{3, 1,	10, 0,	50, 0}, 
/* 	ADVANCED */	{0, 2,	10, 0,	80, 7},	
/* 	VETERAN */	{0, 0,	15, 0,	120, 10},
/* 	EXPERT */	{4, 0,	15, 0,	170, 0},
/* 	HITMAN */	{0, 2,	0, 8,	200, 30},
/*	OWNER */	{4, 3,	20, 10,	250, 50}},
	
/* WEAPONS_AK47 */    {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,  	8, 0,   	30, 1},
/* 	BASIC 	*/	{3, 1,	13, 0,	70, 0}, 	
/* 	ADVANCED */	{3, 2,	15, 0,	80, 7},	
/* 	VETERAN */	{3, 0,	15, 0,	150, 20},
/* 	EXPERT */	{4, 1,	15, 4,	200, 30},	
/* 	HITMAN */	{0, 3,	0, 10,	250, 40},
/*	OWNER */	{4, 3,	20, 10,	500, 100}},
	
/* WEAPONS_KNIFE */   {//K, H,	K, H,	K, H
/* 	BEGINNER */	{0, 0,	2, 0,	10, 0}, 
/* 	BASIC 	*/	{0, 0,	2, 0,	30, 0}, 
/* 	ADVANCED */	{0, 0,	2, 0,	40, 0},
/* 	VETERAN */	{0, 0,	2, 0,	50, 2},
/* 	EXPERT */	{0, 1,	4, 0,	60, 3},
/* 	HITMAN */	{0, 0,	4, 2,	70, 5},
/*	OWNER */	{2, 0,	5, 0,	100, 8}},
	
/* WEAPONS_P90 */      {//K, H,	K, H,	K, H
/* 	BEGINNER */	{2, 0,  	5, 0,   	30, 1}, 
/* 	BASIC 	*/	{3, 1,	10, 0,	50, 0}, 	
/* 	ADVANCED */	{0, 2,	10, 0,	80, 7},
/* 	VETERAN */	{0, 0,	15, 0,	120, 10},
/* 	EXPERT */	{4, 0,	15, 0,	170, 0},
/* 	HITMAN */	{0, 2,	0, 8,	200, 30},
/*	OWNER */	{4, 3,	20, 10,	250, 50}}	
}
//}


//{ XP RANKS
new RankLevel[RANKS] = {
	0,
	100,
	250,
	500,
	1000,
	
	2000,
	3000,
	4000,
	5000,
	6000,
	
	7000,
	9000,
	11000,
	12000,
	15000,
	
	20000, 
	30000, 
	50000,
	80000 
	}
//}
